<template>
  <div class="p-home">
    <center-map></center-map>
    <div class="p-home-slider">
      <router-view></router-view>
    </div>
    <!--    <Slider></Slider>-->
  </div>
</template>
<script setup lang="ts">
import CenterMap from "@/components/CenterMap.vue";
import {
  createDataTable,
  createLayerTable,
  delTable,
  hasTable,
  openDb,
} from "@/api/sql.ts";
import { onMounted } from "vue";

// import Slider from "./modules/Slider.vue";

async function init() {
  await openDb();

  const b = await hasTable("layer");
  if (!b) {
    console.log("初始化数据表");

    await delTable("layer");
    await delTable("data");

    await createLayerTable();
    await createDataTable();
  } else {
    console.log("数据表已存在");
  }
}

onMounted(async () => {
  await init();
});
</script>
<style scoped lang="less">
.p-home {
  height: 100%;
  width: 100%;

  &-slider {
    width: 300px;
    position: absolute;
    top: 30px;
    right: 10px;
    bottom: 10px;
    z-index: 1000;
  }
}
</style>
